package com.sky.mapper;

import com.sky.entity.Orders;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    void insert(Orders orders);


    void update(Orders orders);

    @Update("update orders set status=#{status} where id=#{orderId}")
    void updateOrderStatus(@Param("orderId") Integer orderId, @Param("status") Integer status);

    @Select("select * from orders where id=#{id}")
    Orders getOrersById(Integer id);


    Double sunByMap(Map map);


    //每日订单数
    Integer getEveryOrderCount(Map map);

    @Select("select count(*) from orders where status=5")
    Integer getValidCount();

    @Select("select count(*) from orders")
    Integer getTotalOrderCount();


    Double getNowTurnOver(Map map);

    @Select("select count(*) from orders where status=2")
    Integer getWaitAcceptOrder();

    @Select("select count(*) from orders where status=3")
    Integer getWaitSendOrder();

    @Select("select count(*) from orders where status=6")
    Integer getAlreadyCancelOrder();

}
